package visitor.example;

/**
 * @Author：LJ
 * @Description：
 * @Date: 2017/12/3
 * @Modified By:
 */
public class Visitor implements IVisitor {
    @Override
    public void visit(CommonEmployee commonEmployee) {
        System.out.println(getCommonEmployee(commonEmployee));
    }

    @Override
    public void visit(Manager manager) {
        System.out.println(getManagerEmployee(manager));
    }

    private String getManagerEmployee(Manager manager) {
        return getBasicInfo(manager) + "\t 职责:" + manager.getPerformance();
    }

    private String getCommonEmployee(CommonEmployee employee) {
        return getBasicInfo(employee) + "\t 工作:" + employee.getJod();
    }

    private String getBasicInfo(Employee employee) {
        return "姓名:" + employee.getName() + "\t 性别：" + employee.getSex() + "\t 薪水:" + employee.getSalary();
    }
}
